# 一、
import tkinter as tk
# 建立窗口

def A():
   print("按钮被点击")
window = tk.Tk()
window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x200+%d+%d'%((width-400)/2,(height-200)/2))
tk.Button(window,text="按钮",command=A).pack()
window.mainloop()
# 二、按钮设置大小

import tkinter as tk
# 建立窗口

def A():
   print("按钮被点击")
window = tk.Tk()

window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x200+%d+%d'%((width-400)/2,(height-200)/2))
tk.Button(window,text="按钮",width=10,height=10,command=A).pack()
window.mainloop()
# 三、禁止点击

import tkinter as tk
# 建立窗口

def A():
   print("按钮被点击")
window = tk.Tk()

window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x200+%d+%d'%((width-400)/2,(height-200)/2))
tk.Button(window,text="按钮",width=10,height=10,command=A,state='disabled').pack()
window.mainloop()
